﻿using System;
using ProjScan.RecordManager;
using ProjScan.RecordManager.AssetData;
using ProjScan.ScanRule.Attr;
using UnityEditor;
using UnityEngine;

namespace ProjScan.ScanRule.ProjectAssets.Animation
{
	// Token: 0x020001F8 RID: 504
	[AnimationRuleAttr]
	internal class AnimationClip_ScaleCurve : RecordRuleImp<AnimationClipAssetData, AnimationClipRecordManager>
	{
		// Token: 0x06000EFB RID: 3835 RVA: 0x00007356 File Offset: 0x00005556
		protected override bool IsOK(AnimationClipAssetData assetData)
		{
			return !this.HasUselessScaleCurve(assetData.asset);
		}

		// Token: 0x06000EFC RID: 3836 RVA: 0x00042DE4 File Offset: 0x00040FE4
		private bool HasUselessScaleCurve(AnimationClip clip)
		{
			bool flag = clip != null;
			if (flag)
			{
				foreach (EditorCurveBinding editorCurveBinding in AnimationUtility.GetCurveBindings(clip))
				{
					bool flag2 = editorCurveBinding.propertyName.ToLower().Contains("scale");
					if (flag2)
					{
						bool flag3 = true;
						AnimationCurve editorCurve = AnimationUtility.GetEditorCurve(clip, editorCurveBinding);
						bool flag4 = editorCurve != null && editorCurve.keys != null;
						if (flag4)
						{
							Keyframe[] keys = editorCurve.keys;
							int num = 0;
							while (keys != null && num < keys.Length)
							{
								float value = keys[num].value;
								bool flag5 = (double)value < 0.9800000190734863 || (double)value > 1.0199999809265137;
								if (flag5)
								{
									flag3 = false;
									break;
								}
								num++;
							}
							bool flag6 = flag3;
							if (flag6)
							{
								return true;
							}
						}
					}
				}
			}
			return false;
		}
	}
}
